'use strict';

const Controller = require('egg').Controller;

class DefaultController extends Controller {
  async exchange() {
    const { ctx, app } = this;
    const nsp = app.io.of('/');
    console.log(Object.keys(nsp.sockets));
    const socket = ctx.socket;
    const client = socket.id;
    await nsp.emit('sss', `Hi! I've got your message: ${client}`);
  }
}

module.exports = DefaultController;
